package jtk.project4.fleet.field;

import java.awt.Dimension;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.RadioButton;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.TextField;
import nl.coderight.jazz.form.field.SpinnerField;
import nl.coderight.jazz.form.control.RadioControl;



public class LaborDetailField extends GroupControl{
	
	private RadioButton employeeButton;
	private RadioButton vendorButton;
	private TextField laborRateField;
	private SpinnerField<Integer> hoursField;
	private TextField totalCostField;
	private RadioControl<String> radioControl;
	private ComboField LaborCombo;
	
	public LaborDetailField(String bindID){
		setTitle("Labor Detail");
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields(){
		laborRateField = new TextField ("Labor Rate",10);
		totalCostField = new TextField ("Total Cost",10);
		totalCostField.setEditable(false);
		//hoursField = new SpinnerField ("Hours","0");
		radioControl = new RadioControl<String>("radio control") ;
		vendorButton = new RadioButton ("Vendor");
		employeeButton = new RadioButton ("Employee");
		radioControl.addRadioButton(employeeButton, "Employee");
		radioControl.addRadioButton(vendorButton, "Vendor");
		Dimension dimension = new Dimension(50, 20);
		hoursField = new SpinnerField<Integer> ("domains","domain");
		hoursField.setPreferredSize(dimension);
		hoursField.setValue(10);
		LaborCombo = new ComboField ("","");
		LaborCombo.setEditable(false);
		LaborCombo.setPreferredSize(dimension);
	}
	
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())
			.addLabel("Perform By:") 	.addField(radioControl)
			.addLabel("Labor Rate") 		.addField(laborRateField)
			.addRow()
			.addField(LaborCombo,Resize.HORIZONTAL)
			.addLabel("Hour") 				.addField(hoursField)
			.addLabel("Total cost")			.addField((totalCostField))
		;
	}
	
	

}
